//
//  UITableView+Lc.m
//  18Birdies
//
//  Created by Lc on 15/4/27.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import "UITableView+Lc.h"

@implementation UITableView (Lc)

- (void)deselectRow {
  NSIndexPath* selectingIndexPath = [self indexPathForSelectedRow];
  if (selectingIndexPath != nil) {
    [self deselectRowAtIndexPath:selectingIndexPath animated:YES];
  }
}

- (void)scrollToTop {
  [self scrollToTopWithAnimated:YES];
}

- (void)scrollToTopWithAnimated:(BOOL)animated {
  [self setContentOffset:CGPointMake(0, 0) animated:animated];
}

- (void)scrollToBottom {
  [self scrollToBottomWithAnimated:YES];
}

- (void)scrollToBottomWithAnimated:(BOOL)animated {
  [self setContentOffset:CGPointMake(0, self.contentSize.height - self.bounds.size.height)
                animated:animated];
}

@end
